package com.siruier.boss.bean

import android.os.Parcelable
import com.siruier.boss.R
import com.siruier.boss.common.formatPrice
import com.siruier.boss.ui.bean.picker.BaseCityBean
import com.siruier.boss.ui.listener.OnCheckBean
import kotlinx.parcelize.Parcelize
import java.math.BigDecimal

class CommonBean(
    val key: String,
    val value: String,
)

data class MineFun(
    val resId: Int,
    val funName: String,
)

data class MineMyOrderFun(
    val resId: Int,
    val funName: String,
    var dot: Int = 0,
)

data class DeviceInfoBean(
    // 是否有root权限
    val isRoot: Boolean,
    // 是否被调试
    val isBeingTraced: Boolean,
    // 是否在Xposed
    val isXposed: Boolean,
    // 是否多开
    val isVirtual: Boolean,
    // 是否模拟器
    val isEmulator: Boolean,
    // 是否VPN
    val isVpn: Boolean,
)

data class CmTypeBean(
    val typeName: String,
    val type: Int?,
    val typeNum: Int,
    var check: Boolean = false,
) : OnCheckBean {
    override fun changeCheck(check: Boolean) {
        this.check = check
    }

    override fun check() = this.check
    override fun showName() = typeName
}

data class CmUserAddBean(
    val typeName: String,
    val typeNum: Int,
)

data class MallPageBean<T>(
    val records: MutableList<T> = mutableListOf(),
    val total: Int = 0,
)

data class MallCategoryBean(
    val desc: String = "",
    val iconUrl: String = "",
    val id: Int? = null,
    val keywords: String = "",
    val name: String = "",
    val picUrl: String = "",
    val sortOrder: Int = 0,
    val children: MutableList<MallCategoryBean> = mutableListOf(),
    var check: Boolean = false
) : OnCheckBean {
    override fun showName() = name
    override fun check() = check
    override fun changeCheck(check: Boolean) {
        this.check = check
    }
}

@Parcelize
data class MallCategorySimpleBean(
    val id: Int? = null,
    val name: String = "",
) : Parcelable

@Parcelize
data class MallGoodsBean(
    val brandId: Int = 0,
    val brief: String = "",
    val categoryId: Int = 0,
    val counterPrice: String = "",
    val detail: String = "",
    val gallery: String = "[]",
    val goodsSn: String = "",
    val hot: String = "",
    val id: Int = 0,
    val isNew: String = "",
    val keywords: String = "",
    val name: String = "",
    val onSale: Int = 0,
    val picUrl: String = "",
    val freightPrice: Double = 0.0,
    val marketPrice: Double = 0.0,
    val priceDesc: String = "",
    val retailPrice: Double = 0.0,
    val floorPrice: Double = 0.0,
    val shareUrl: String = "",
    val sortOrder: Int = 0,
    val unit: String = "",
    val vipType: Int = 0,
    val specifications: String = "[]",
    val agentPrice: Double? = null,
    val bossPrice: Double? = null,
    //商品类型 1-普通商品 2-代理加盟商品 3-门店合作商品 4-0元福利 5-限时抢购
    val type: Int = 1,
) : Parcelable


data class MallGoodsProductBean(
    val goodsId: Int = 0,
    val id: Int = 0,
    val number: Int = 0,
    val price: Double = 0.0,
    val priceDesc: String = "",
    val specifications: String = "",
    val specificationsId: String = "",
    val updateTime: String = "",
    val url: String = "",
    val addTime: String = "",
    val deleted: String = "",
)

data class MallGoodsSpecInfoBean(
    val goodsProductMap: MutableMap<String, MallGoodsProductBean> = mutableMapOf(),
    val specnList: MutableList<MallGoodsSpecReceiveBean> = mutableListOf(),
)

/**
 * 商品规格，有两级，比如:红色  1米
 */
data class MallGoodsSpecReceiveBean(
    val name: String = "",
    val values: MutableList<MallGoodsSpecChildrenBean> = mutableListOf(),
)

data class MallGoodsSpecChildrenBean(
    val id: String = "",
    val picUrl: String = "",
    val value: String = "",
    var check: Boolean = false,
) : OnCheckBean {
    override fun showName() = value
    override fun check() = check
    override fun changeCheck(check: Boolean) {
        this.check = check
    }
}

@Parcelize
data class ShopAddressBean(
    var id: Int? = null,
    var name: String = "",
    var phone: String = "",
    var province: String = "",
    var provinceCode: String = "",
    var city: String = "",
    var cityCode: String = "",
    var county: String = "",
    var countyCode: String = "",
    var address: String = "",
    var deful: String = "0",
) : Parcelable

data class ShareCode(
    val url: String = ""
)

@Parcelize
data class ConfirmOrderGoodsBean(
    val goodsId: Int = 0,
    val goodsName: String = "",
    val goodsSn: String = "",
    val number: Int = 0,
    val picUrl: String = "",
    val price: BigDecimal = BigDecimal("0.0"),
    val priceDesc: String = "",
    val specifications: String = "",
    val marketPrice: Double = 0.0,
    val marketPriceDesc: String = "",
    val vipPrice: Double = 0.0,
    val vipPriceDesc: String = "",
) : Parcelable

data class OrderDetailBean(
    val storeName: String = "",
    var comment: String = "",
    val actualPrice: Double = 0.0,
    val address: String = "",
    val aftersaleStatus: Int = 0,
    val confirmTime: String = "",
    val consignee: String = "",
    val endTime: String = "",
    val freightPrice: BigDecimal = BigDecimal("0.0"),
    val goodsList: MutableList<ConfirmOrderGoodsBean> = mutableListOf(),
    val goodsPrice: Double = 0.0,
    val message: String = "",
    val mobile: String = "",
    val orderPrice: BigDecimal = BigDecimal("0.0"),
    val priceDesc: String = "",
    val orderSn: String = "",
    val orderStatus: Int = GoodsOrderStateEnum.ALL.state,
    val ramainSeconds: Int = 0,
    val shipTime: String = "",
    val createTime: String = "",
    val payTime: String = "",
    val payType: Int = 1,//1-积分支付 2-金额支付
    val shipChannel: String = "",
    val shipSn: String = "",
    val goodsType: Int = 0,
    val type: Int = 0,
)

data class GiftOrderDetailBean(
    val endTime: String = "",
    val giveDealStatus: Int = 0,
    val goodsList: MutableList<ConfirmOrderGoodsBean> = mutableListOf(),
    val orderId: Int = 0,
    val orderPrice: BigDecimal = BigDecimal.ZERO,
    val orderSn: String = "",
    val orderStatus: Int = 0,
    val recoverPrice: String = "",
    val saleStatus: Int = 0,
    val shipChannel: String = "",
    val shipSn: String = "",
    val shipTime: String = "",
    val status: Int = 0,
    val receiveUserPhone: String = "",
    val receiveTime: String = "",
    val giveTime: String = "",
    val goodsType: Int = 0,
    //审核状态 0-未提交 1-待审核 2-审核通过 3-审核拒绝
    val auditStatus: Int = 0,
    //拒绝原因
    val rejectReason: String = "",
)

@Parcelize
enum class GoodsOrderStateEnum(
    val state: Int,
    val stateName: String,
    val stateShow: String
) : Parcelable {
    ALL(0, "全部", ""),
    OBLIGATION(101, "待付款", "等待买家付款"),
    USER_CANCEL(102, "已取消", "用户取消"),
    SYS_CANCEL(103, "已取消", "系统取消"),
    PAID_PAY(201, "已付款", "已付款"),
    APPLY_REFUND(202, "申请退款", "申请退款"),
    REFUNDED(203, "已退款", "已退款"),
    DELIVERED(301, "已发货", "已发货"),
    USER_RECEIVING(401, "用户收货", "用户收货"),
    SYS_RECEIVING(402, "系统收货", "系统收货")
}

//用户等级 1-普通会员 2-代理 3-老板
enum class UserLevelEnum(
    val level: Int,
    val levelName: String,
    val levelResId: Int,
) {
    MEMBER(1, "普通用户", R.mipmap.icon_vip_no),
    AGENT(2, "VIP", R.mipmap.icon_level_2),
    BOSS(3, "服务商", R.mipmap.icon_level_3),
}


@Parcelize
enum class GoodsOrderShowStateEnum(
    val state: Int,
    val stateName: String,
) : Parcelable {
    ALL(0, "全部"),
    OBLIGATION(1, "待付款"),
    DELIVERED(2, "待发货"),
    RECEIVED(3, "待收货"),
    COMPLETED(4, "已完成"),
    CANCELLED(5, "已取消"),
}

data class PayOrder(
    val orderNo: String = "",
    val payAmount: BigDecimal = BigDecimal.ZERO,
    val prepayContent: String? = null,
    val isPayInvoke: Int = 0,
    val payStatus: Int = 0,//支付状态 0-未支付 1-已支付 2-支付中
    val weChatPayParams: WeChatPayParamsBean? = null,
)

data class DiscountVO(
    val discount: BigDecimal = BigDecimal("0.0")
)

data class PreSaleVO(
    val recoverPrice: String = "",
)

data class PayModel(
    var payWay: String? = null,
    var orderPrice: BigDecimal? = null,
    var balance: BigDecimal? = null,
    var integral: BigDecimal? = null,
    var orderSn: String? = null,
    var phone: String? = null,
    var orderType: Int = 1,
)

data class PayChannel(
    val addTime: String = "",
    val appType: String = "",
    val channelCode: String = "",
    val channelName: String = "",
    val id: Int = 0,
    val img: String = "",
    val status: Int = 0,
    val updateTime: String = "",
    var check: Boolean = false,
) : OnCheckBean {
    override fun changeCheck(check: Boolean) {
        this.check = check
    }

    override fun check() = this.check
    override fun showName() = channelName
}

data class WeChatPayParamsBean(
    val appId: String,
    val nonceStr: String,
    val packageValue: String,
    val partnerId: String,
    val prepayId: String,
    val sign: String,
    val timeStamp: String
)

data class ShipRecord(
    val comName: String = "",
    val logo: String = "",
    val nu: String = "",
    val tel: String = "",
    val updateTime: String = "",
    val data: MutableList<LogisticsDetailBean>? = null,
)

data class LogisticsDetailBean(
    val time: String = "",
    val address: String = "",
    val context: String = "",
    val location: String = "",
    val status: Int? = null,
)

enum class LogisticsStateEnum(
    val state: Int,
    val stateName: String
) {
    STATE_1(-1, "无效状态"),
    STATE0(101, "揽件"),
    STATE1(102, "在途中"),
    STATE2(103, "派送中"),
    STATE3(104, "已签收"),
    STATE4(105, "用户拒签"),
    STATE5(106, "疑难件"),
    STATE6(107, "无效单"),
    STATE7(108, "超时单"),
    STATE10(109, "签收失败"),
    STATE11(110, "退回"),
    STATE12(111, "转投"),
    STATE13(112, "待签"),
}

//状态 0-待付款 1-待赠送 2-已赠送 3-已接收 4-已取消
@Parcelize
enum class GiftWarehouseSendStateEnum(
    val state: Int?,
    val stateName: String,
) : Parcelable {
    ALL(null, "全部"),
    WAIT_PAY(0, "待付款"),
    WAIT_TRANSFER(1, "待赠送"),
    HAVE_TRANSFER(2, "已赠送"),
    HAVE_RECEIVED(3, "已接收"),
    CANCELLED(4, "已取消"),
}

//状态 0-待处理 1-自用 2-赠送 3-挂卖
@Parcelize
enum class GiftWarehouseReceiveStateEnum(
    val state: Int?,
    val stateName: String,
) : Parcelable {
    WAIT_HANDLE(0, "待处理"),
    SELF_USE(1, "自用"),
    PASS_ON(2, "赠送"),
    HANGING_SALE(3, "挂卖"),
}

// 自用状态 0-待发货 1-已发货 2-已收货
@Parcelize
enum class GiftWarehouseReceiveSelfUseStateEnum(
    val state: Int?,
    val stateName: String
) : Parcelable {
    WAIT_SEND(0, "待发货"),
    SHIPPED(1, "已发货"),
    RECEIVED_GOODS(2, "已收货"),
}

//赠送状态 0-已赠送 1-已接收
@Parcelize
enum class GiftWarehouseReceivePassOnStateEnum(
    val state: Int?,
    val stateName: String,
) : Parcelable {
    DONATED(0, "已赠送"),
    RECEIVED(1, "已接收"),
}

//挂卖状态 0-挂卖中 1-已挂卖 2-已撤销
@Parcelize
enum class GiftWarehouseReceiveHangingSaleStateEnum(
    val state: Int?,
    val stateName: String,
) : Parcelable {
    ON_SALE(0, "挂卖中"),
    SOLD(1, "已挂卖"),
    REVOKED(2, "已撤销"),
}

@Parcelize
data class LocationSelect(
    val provBean: BaseCityBean,
    var cityBean: BaseCityBean,
    val counBean: BaseCityBean,
    val title: String,
    val poiName: String,
    val address: String,
) : Parcelable

data class MobilePayPriceVo(
    val price: BigDecimal = BigDecimal.ZERO,
    val showPrice: BigDecimal = BigDecimal.ZERO,
    var check: Boolean = false,
) : OnCheckBean {
    override fun changeCheck(check: Boolean) {
        this.check = check
    }

    override fun check() = this.check
    override fun showName() = showPrice.formatPrice()
}

data class BlTelRecharge(
    val addTime: String = "",
    val amount: BigDecimal = BigDecimal.ZERO,
    val cardNum: String = "",
    val orderNo: String = "",
    val phone: String = "",
    val reason: String = "",
    val sporderId: String = "",
    val status: Int = 0,
    val updateTime: String = "",
    val userId: Int = 0
)

data class UserMobilePackage(
    val addTime: String = "",
    val agreementFile: String = "",
    val auditStatus: Int = 0,
    val checkTime: String = "",
    val orderSn: String = "",
    val phone: String = "",
    val receiptImg: String = "",
    val remark: String = "",
    val sign: String = "",
    val status: Int = 0,
    val updateTime: String = "",
)

@Parcelize
data class City(
    val code: Int = 0,
    val level: Int = 0,
    val name: String = "",
    val pId: Int = 0,
    val child: MutableList<City>?,
    var check: Boolean = false,
) : Parcelable

@Parcelize
data class NumberListVO(
    val cityname: String = "",
    val mobileno: String = "",
    val region: String = "",
    val sid: String = "",
    var check: Boolean = false,
) : Parcelable